Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGridPro] Support pinned columns and dynamic row height #5782

Merged
merged 10 commits into from
Sep 1, 2022

Conversation

m4theushw
Copy link
Member

@m4theushw m4theushw commented Aug 13, 2022

Preview: https://deploy-preview-5782--material-ui-x.netlify.app/x/react-data-grid/column-pinning/#usage-with-dynamic-row-height

Closes #5137

The approach I took was to split the base size stored in rowsHeightLookup to also store the size for the other row components that make part of a single row. Now we have:

  • baseLeft: base size for the cells from the left pinned columns
  • baseCenter: base size for the cells from the center, it's the old base size
  • baseRight: base size for the cells from the right pinned columns

When we calculate the content size we check all base sizes, using a regex, and take the biggest. To make all row components to look aligned I use minHeight with the value calculated earlier. This is also one trade-off of this solution: if the content changes and the new row height is smaller it won't be reflected. This happens because the minimum height forces the row to have that minimum size, also impacting the ResizeObserver measurements. As solution, I added an API method to reset the heights.

@m4theushw m4theushw added component: data grid This is the name of the generic UI component, not the React module! plan: Pro Impact at least one Pro user labels Aug 13, 2022
@mui-bot
Copy link

mui-bot commented Aug 13, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 373.9 732.7 536.9 537.4 135.97
Sort 100k rows ms 729.4 1,178.6 944.5 961.46 142.841
Select 100k rows ms 208.3 435.3 259.5 291.62 77.474
Deselect 100k rows ms 125.8 289.5 197.5 204.38 52.465

Generated by 🚫 dangerJS against 585dafe

@m4theushw m4theushw marked this pull request as ready for review August 17, 2022 22:05
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 1, 2022
@github-actions
Copy link

github-actions bot commented Sep 1, 2022

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 1, 2022
@m4theushw m4theushw merged commit 4cebcdf into mui:master Sep 1, 2022
@m4theushw m4theushw deleted the dynamic-row-height-column-pinning branch September 1, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! plan: Pro Impact at least one Pro user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Improve support to dynamic row height with pinned columns
3 participants